package com.aliyun.servlet;

import java.net.URLEncoder;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import net.sf.json.JSONArray;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.aliyun.service.NikeService;


@Controller 
public class BaiLianController {
    @Resource
	private NikeService nikeService;
    
    @ResponseBody
	@RequestMapping(value="/getAllBaiLian",method = RequestMethod.GET,produces = {"application/text;charset=UTF-8"}) 
	public String getAllNikeOrder() throws Exception
	{	
    	String returnstr = "{}";
    	try {
			List<Map<String,Object>> orderList = nikeService.getAllBaiLian();
			if(orderList!=null && orderList.size()>0){
				JSONArray jArr = JSONArray.fromObject(orderList);
				returnstr = jArr.toString();
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return URLEncoder.encode(returnstr,"utf-8");
	}
}
